Skip to content

Conversation

@Osier-Yi
Copy link
Member

@Osier-Yi Osier-Yi commented Jan 9, 2026

AgentScope Version

[The version of AgentScope you are working on, e.g. import agentscope; print(agentscope.__version__)]

Description

Add A2ui example:
In this example, we demonstrate how to integrate A2UI into a ReAct agent in AgentScope. This
implementation is based on the official A2UI agent samples, adapted to use AgentScope's agent
framework.

related issue: #1047

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has been formatted with pre-commit run --all-files command
  • All tests are passing
  • Docstrings are in Google style
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

@Osier-Yi Osier-Yi requested a review from DavdGao January 9, 2026 07:59
@Osier-Yi Osier-Yi requested a review from lishengzxc January 9, 2026 09:26
@Osier-Yi Osier-Yi added Ready for Review example Example related PR labels Jan 9, 2026
Copy link
Member

@DavdGao DavdGao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plz expose the python code to the top so that we can review the example

@DavdGao
Copy link
Member

DavdGao commented Jan 20, 2026

/gemini review

"""


if __name__ == "__main__":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unnecessary code here


**Use the `execute_shell_command` tool to run (make sure you are in the skill directory):**
```bash
python -m view_a2ui_schema --schema_category BASE_SCHEME
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

==》 schema

.wireit/
.angular/
*.ts
*.ts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping *.ts in .gitignore seems conflict with the current pull request?


# # --8<-- [start:send_message_streaming]

# streaming_request = SendStreamingMessageRequest(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove unnecessary code

@@ -0,0 +1,110 @@
# A2UI in AgentScope
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current directory hierarchy appears to have some redundant nesting:

examples/agent/a2ui_agent
└── samples
    └── agent
        └── general_agent
            ├── skills
            └── xxx.py
    └── client
    └── README.md

It seems that the samples/agent/general_agent layers don't serve a clear organizational purpose at the moment. I'd suggest considering a flatter structure:

examples/agent/a2ui_agent
├── skills
├── client
├── xxx.py
└── README.md

@DavdGao
Copy link
Member

DavdGao commented Jan 20, 2026

/gemini help

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds an A2UI example to AgentScope, demonstrating how to integrate A2UI into a ReAct agent. The changes include adding a new example directory with agent and client code, utility functions for A2UI integration, and a README file explaining the example. The review comments identify areas for improvement related to code security and adherence to the repository's code review guide, specifically around lazy loading of dependencies and comment standards. All original comments have been retained as they do not contradict the provided rules.

name="Friday",
sys_prompt=get_ui_prompt(),
model=DashScopeChatModel(
model_name="qwen-max",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

According to the repository's code review guide (line 11), third-party library dependencies should be imported at the point of use, not at the top of the file. Consider moving this import inside the on_message_send_stream function.

    ) -> AsyncGenerator[Event, None]:
        from agentscope.tool import (
            Toolkit,
            view_text_file,
            execute_python_code,
            execute_shell_command,
        )
        
References
  1. Third-party library dependencies should be imported at the point of use, avoid centralized imports at file top (link)
  2. Third-party library dependencies should be imported at the point of use, avoid centralized imports at file top. The Third-party library refers to libraries not included in the dependencies variable in pyproject.toml.

Comment on lines +29 to +39
from agentscope.formatter import DashScopeChatFormatter, A2AChatFormatter
from agentscope.model import DashScopeChatModel
from agentscope.pipeline import stream_printing_messages
from agentscope.session import JSONSession
from agentscope.tool import (
Toolkit,
view_text_file,
execute_python_code,
execute_shell_command,
)
from agentscope.message import Msg
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

According to the repository's code review guide (lines 45-61), all classes/methods must have complete docstrings, strictly following the template. Please add docstrings to this class.

References
  1. All classes/methods must have complete docstrings, strictly following the template (link)

Comment on lines +42 to +54
def get_final_structured_output(message: Msg) -> None | str:
"""Get the final structured output from the message."""
if isinstance(message.content, list):
for block in message.content:
if (
isinstance(block, dict)
and block.get("type") == "tool_use"
and block.get("name") == "generate_response"
):
input_data = block.get("input")
if input_data is not None and isinstance(input_data, dict):
return input_data.get("response_with_a2ui")
return None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

According to the repository's code review guide (lines 45-61), all classes/methods must have complete docstrings, strictly following the template. Please add docstrings to this function.

References
  1. All classes/methods must have complete docstrings, strictly following the template (link)

Comment on lines +61 to +66
async def _prepare_final_message(
self,
formatter: A2AChatFormatter,
final_msg_text: str | None,
last_complete_msg: Msg | None,
) -> Message:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

According to the repository's code review guide (lines 45-61), all classes/methods must have complete docstrings, strictly following the template. Please add docstrings to this function.

References
  1. All classes/methods must have complete docstrings, strictly following the template (link)

@gemini-code-assist
Copy link
Contributor

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

example Example related PR Ready for Review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants